home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / tcl / extend / configure < prev    next >
Encoding:
Text File  |  1993-10-26  |  48.9 KB  |  1,902 lines  |  [TEXT/MPS ]

  1.  
  2. #!/bin/sh
  3. # Guess values for system-dependent variables and create Makefiles.
  4. # Generated automatically using autoconf.
  5. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  6.  
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2, or (at your option)
  10. # any later version.
  11.  
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16.  
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  22. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  23. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  24. # --with-PACKAGE unless this script has special code to handle it.
  25.  
  26.  
  27. for arg
  28. do
  29.   # Handle --exec-prefix with a space before the argument.
  30.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  31.   # Handle --host with a space before the argument.
  32.   elif test x$next_host = xyes; then next_host=
  33.   # Handle --prefix with a space before the argument.
  34.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  35.   # Handle --srcdir with a space before the argument.
  36.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  37.   else
  38.     case $arg in
  39.      # For backward compatibility, also recognize exact --exec_prefix.
  40.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  41.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  42.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  43.     next_exec_prefix=yes ;;
  44.  
  45.      -gas | --gas | --ga | --g) ;;
  46.  
  47.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  48.      -host | --host | --hos | --ho | --h)
  49.     next_host=yes ;;
  50.  
  51.      -nfp | --nfp | --nf) ;;
  52.  
  53.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  54.         no_create=1 ;;
  55.  
  56.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  57.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  58.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  59.     next_prefix=yes ;;
  60.  
  61.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  62.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  63.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  64.     next_srcdir=yes ;;
  65.  
  66.      -with-* | --with-*)
  67.        package=`echo $arg|sed 's/-*with-//'`
  68.        # Delete all the valid chars; see if any are left.
  69.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  70.          echo "configure: $package: invalid package name" >&2; exit 1
  71.        fi
  72.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  73.  
  74.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  75.        verbose=yes ;;
  76.  
  77.      *) ;;
  78.     esac
  79.   fi
  80. done
  81.  
  82. trap 'rm -fr conftest* core; exit 1' 1 3 15
  83.  
  84. # NLS nuisances.
  85. # These must not be set unconditionally because not all systems understand
  86. # e.g. LANG=C (notably SCO).
  87. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  88. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  89.  
  90. rm -f conftest*
  91. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  92.  
  93. # A filename unique to this package, relative to the directory that
  94. # configure is in, which we can look for to find out if srcdir is correct.
  95. unique_file=src/tclExtend.h
  96.  
  97. # Find the source files, if location was not specified.
  98. if test -z "$srcdir"; then
  99.   srcdirdefaulted=yes
  100.   # Try the directory containing this script, then `..'.
  101.   prog=$0
  102.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  103.   test "X$confdir" = "X$prog" && confdir=.
  104.   srcdir=$confdir
  105.   if test ! -r $srcdir/$unique_file; then
  106.     srcdir=..
  107.   fi
  108. fi
  109. if test ! -r $srcdir/$unique_file; then
  110.   if test x$srcdirdefaulted = xyes; then
  111.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  112.   else
  113.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  114.   fi
  115.   exit 1
  116. fi
  117. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  118. # But we can't avoid them for `..', to make subdirectories work.
  119. case $srcdir in
  120.   .|/*|~*) ;;
  121.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  122. esac
  123.  
  124. # Save the original args to write them into config.status later.
  125. configure_args="$*"
  126.  
  127. #!/bin/sh
  128. # From configure.in Revision: 1.6 
  129.  
  130.  
  131.  
  132.  
  133. #------------------------------------------------------------------------------
  134. #     Check for various programs used during the build.
  135. #------------------------------------------------------------------------------
  136.  
  137. for p in 'bison -y' byacc
  138. do
  139. if test -z "$YACC"; then
  140.   # Extract the first word of `$p', so it can be a program name with args.
  141.   set dummy $p; word=$2
  142.   echo checking for $word
  143.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  144.   for dir in $PATH; do
  145.     test -z "$dir" && dir=.
  146.     if test -f $dir/$word; then
  147.       YACC="$p"
  148.       break
  149.     fi
  150.   done
  151.   IFS="$saveifs"
  152. fi
  153.  
  154. test -n "$YACC" -a -n "$verbose" && echo "    setting YACC to $YACC"
  155.  
  156. test -n "$YACC" && break
  157. done
  158. test -n "$YACC" || YACC="yacc"
  159.  
  160. if test -z "$CC"; then
  161.   # Extract the first word of `gcc', so it can be a program name with args.
  162.   set dummy gcc; word=$2
  163.   echo checking for $word
  164.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  165.   for dir in $PATH; do
  166.     test -z "$dir" && dir=.
  167.     if test -f $dir/$word; then
  168.       CC="gcc"
  169.       break
  170.     fi
  171.   done
  172.   IFS="$saveifs"
  173. fi
  174. test -z "$CC" && CC="cc"
  175. test -n "$CC" -a -n "$verbose" && echo "    setting CC to $CC"
  176.  
  177. # Find out if we are using GNU C, under whatever name.
  178. cat > conftest.c <<EOF
  179. #ifdef __GNUC__
  180.   yes
  181. #endif
  182. EOF
  183. ${CC-cc} -E conftest.c > conftest.out 2>&1
  184. if egrep yes conftest.out >/dev/null 2>&1; then
  185.   GCC=1 # For later tests.
  186. fi
  187. rm -f conftest*
  188.  
  189. echo checking how to run the C preprocessor
  190. if test -z "$CPP"; then
  191.   # This must be in double quotes, not single quotes, because CPP may get
  192.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  193.   # make.  It must be expanded now.
  194.   CPP="${CC-cc} -E"
  195.   cat > conftest.c <<EOF
  196. #include <stdio.h>
  197. Syntax Error
  198. EOF
  199. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  200. if test -z "$err"; then
  201.   :
  202. else
  203.   CPP=/lib/cpp
  204. fi
  205. rm -f conftest*
  206. fi
  207. test ".${verbose}" != "." && echo "    setting CPP to $CPP"
  208.  
  209. if test -z "$RANLIB"; then
  210.   # Extract the first word of `ranlib', so it can be a program name with args.
  211.   set dummy ranlib; word=$2
  212.   echo checking for $word
  213.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  214.   for dir in $PATH; do
  215.     test -z "$dir" && dir=.
  216.     if test -f $dir/$word; then
  217.       RANLIB="ranlib"
  218.       break
  219.     fi
  220.   done
  221.   IFS="$saveifs"
  222. fi
  223. test -z "$RANLIB" && RANLIB=":"
  224. test -n "$RANLIB" -a -n "$verbose" && echo "    setting RANLIB to $RANLIB"
  225.  
  226. if test -z "$MCS_CMD"; then
  227.   # Extract the first word of `"mcs"', so it can be a program name with args.
  228.   set dummy "mcs"; word=$2
  229.   echo checking for $word
  230.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  231.   for dir in $PATH; do
  232.     test -z "$dir" && dir=.
  233.     if test -f $dir/$word; then
  234.       MCS_CMD="mcs -d"
  235.       break
  236.     fi
  237.   done
  238.   IFS="$saveifs"
  239. fi
  240. test -z "$MCS_CMD" && MCS_CMD="touch"
  241. test -n "$MCS_CMD" -a -n "$verbose" && echo "    setting MCS_CMD to $MCS_CMD"
  242.  
  243.  
  244. #------------------------------------------------------------------------------
  245. #       Some make programs require includes to be 
  246. #         .include "file"
  247. #     others...
  248. #         include file
  249. #------------------------------------------------------------------------------
  250.  
  251. echo checking how make handles includes
  252. rm -fr conftestdir
  253. if mkdir conftestdir; then
  254.   cd conftestdir
  255.   cat > Makeinclude <<EOF
  256.  
  257. EOF
  258.   cat > Makefile <<EOF
  259. include Makeinclude
  260.  
  261. all:
  262. EOF
  263.   if make >/dev/null 2>/dev/null; then
  264.     MAKEINCLUDE="include"
  265.     MAKEQUOTE=''
  266.   else
  267.     MAKEINCLUDE=".include"
  268.     MAKEQUOTE='"'
  269.   fi
  270.   cd ..
  271.   rm -fr conftestdir
  272. fi
  273.  
  274.  
  275.  
  276.  
  277. #------------------------------------------------------------------------------
  278. #       If a system doesn't have an opendir function (man, that's old!)
  279. #       then we use the version of dirent.h Ouster supplied, which
  280. #       is compatible with the substitute version of opendir that's
  281. #       provided.  This version only works with V7-style directories.
  282. #------------------------------------------------------------------------------
  283.  
  284. echo checking for opendir
  285. cat > conftest.c <<EOF
  286. #include <ctype.h>
  287. int main() { exit(0); }
  288. int t() { 
  289. /* The GNU C library defines this for functions which it implements
  290.     to always fail with ENOSYS.  Some functions are actually named
  291.     something starting with __ and the normal name is an alias.  */
  292. #if defined (__stub_opendir) || defined (__stub___opendir)
  293. choke me
  294. #else
  295. /* Override any gcc2 internal prototype to avoid an error.  */
  296. extern char opendir(); opendir();
  297. #endif
  298.  }
  299. EOF
  300. if eval $compile; then
  301.   :
  302. else
  303.   {
  304. test -n "$verbose" && \
  305. echo "    defining USE_DIRENT2_H"
  306. DEFS="$DEFS -DUSE_DIRENT2_H=1"
  307. SEDDEFS="${SEDDEFS}\${SEDdA}USE_DIRENT2_H\${SEDdB}USE_DIRENT2_H\${SEDdC}1\${SEDdD}
  308. \${SEDuA}USE_DIRENT2_H\${SEDuB}USE_DIRENT2_H\${SEDuC}1\${SEDuD}
  309. \${SEDeA}USE_DIRENT2_H\${SEDeB}USE_DIRENT2_H\${SEDeC}1\${SEDeD}
  310. "
  311. }
  312.  
  313. fi
  314. rm -f conftest*
  315.  
  316.  
  317.  
  318. #------------------------------------------------------------------------------
  319. #       Do we have the catgets call (X/PG3 message catalogs)?
  320. #       Do we have the getcwd system call?
  321. #       Do we have the select system call?
  322. #       Do we have the setitimer system call?
  323. #       Do we have the setlinebuf call?
  324. #       Do we have the sigaction call?
  325. #       Do we have the getpgid call?
  326. #------------------------------------------------------------------------------
  327. for func in catgets getcwd select setitimer setlinebuf
  328. do
  329. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  330. echo checking for ${func}
  331. cat > conftest.c <<EOF
  332. #include <ctype.h>
  333. int main() { exit(0); }
  334. int t() { 
  335. /* The GNU C library defines this for functions which it implements
  336.     to always fail with ENOSYS.  Some functions are actually named
  337.     something starting with __ and the normal name is an alias.  */
  338. #if defined (__stub_${func}) || defined (__stub___${func})
  339. choke me
  340. #else
  341. /* Override any gcc2 internal prototype to avoid an error.  */
  342. extern char ${func}(); ${func}();
  343. #endif
  344.  }
  345. EOF
  346. if eval $compile; then
  347.   {
  348. test -n "$verbose" && \
  349. echo "    defining ${trfunc}"
  350. DEFS="$DEFS -D${trfunc}=1"
  351. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  352. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  353. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  354. "
  355. }
  356.  
  357. fi
  358. rm -f conftest*
  359. done
  360.  
  361. for func in sigaction setpgid
  362. do
  363. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  364. echo checking for ${func}
  365. cat > conftest.c <<EOF
  366. #include <ctype.h>
  367. int main() { exit(0); }
  368. int t() { 
  369. /* The GNU C library defines this for functions which it implements
  370.     to always fail with ENOSYS.  Some functions are actually named
  371.     something starting with __ and the normal name is an alias.  */
  372. #if defined (__stub_${func}) || defined (__stub___${func})
  373. choke me
  374. #else
  375. /* Override any gcc2 internal prototype to avoid an error.  */
  376. extern char ${func}(); ${func}();
  377. #endif
  378.  }
  379. EOF
  380. if eval $compile; then
  381.   {
  382. test -n "$verbose" && \
  383. echo "    defining ${trfunc}"
  384. DEFS="$DEFS -D${trfunc}=1"
  385. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  386. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  387. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  388. "
  389. }
  390.  
  391. fi
  392. rm -f conftest*
  393. done
  394.  
  395.  
  396.  
  397. #------------------------------------------------------------------------------
  398. #       Check for bzero.  We don't use bzero directly, but older SCO
  399. #       systems have a select FD_ZERO macro that calls bzero, which is
  400. #       only in the X library.  We redefine bzero as a memset call if
  401. #       there is no bzero.  If its not needed, it doesn't hurt
  402. #       anything.
  403. #------------------------------------------------------------------------------
  404. for func in bzero
  405. do
  406. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  407. echo checking for ${func}
  408. cat > conftest.c <<EOF
  409. #include <ctype.h>
  410. int main() { exit(0); }
  411. int t() { 
  412. /* The GNU C library defines this for functions which it implements
  413.     to always fail with ENOSYS.  Some functions are actually named
  414.     something starting with __ and the normal name is an alias.  */
  415. #if defined (__stub_${func}) || defined (__stub___${func})
  416. choke me
  417. #else
  418. /* Override any gcc2 internal prototype to avoid an error.  */
  419. extern char ${func}(); ${func}();
  420. #endif
  421.  }
  422. EOF
  423. if eval $compile; then
  424.   {
  425. test -n "$verbose" && \
  426. echo "    defining ${trfunc}"
  427. DEFS="$DEFS -D${trfunc}=1"
  428. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  429. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  430. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  431. "
  432. }
  433.  
  434. fi
  435. rm -f conftest*
  436. done
  437.  
  438.  
  439. #------------------------------------------------------------------------------
  440. #       Check for missing functions that we need.  They will be
  441. #       compiled in the osSupport directory. Must check for SCO
  442. #       -lintl, which is were strftime is hidden.
  443. #------------------------------------------------------------------------------
  444.  
  445. echo checking for SCO UNIX libintl
  446. cat > conftest.c <<EOF
  447. #if defined(M_UNIX)
  448.   yes
  449. #endif
  450.  
  451. EOF
  452. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  453. if egrep "yes" conftest.out >/dev/null 2>&1; then
  454.   SCO_UNIX=1
  455. fi
  456. rm -f conftest*
  457.  
  458. test -n "$SCO_UNIX" && test -f /lib/libintl.a &&
  459.   LIBS="$LIBS -lintl" # For strftime.
  460.  
  461. echo checking for strftime
  462. cat > conftest.c <<EOF
  463. #include <ctype.h>
  464. int main() { exit(0); }
  465. int t() { 
  466. /* The GNU C library defines this for functions which it implements
  467.     to always fail with ENOSYS.  Some functions are actually named
  468.     something starting with __ and the normal name is an alias.  */
  469. #if defined (__stub_strftime) || defined (__stub___strftime)
  470. choke me
  471. #else
  472. /* Override any gcc2 internal prototype to avoid an error.  */
  473. extern char strftime(); strftime();
  474. #endif
  475.  }
  476. EOF
  477. if eval $compile; then
  478.   :
  479. else
  480.   LIBOBJS="$LIBOBJS strftime.o"
  481. fi
  482. rm -f conftest*
  483.  
  484. echo checking for random
  485. cat > conftest.c <<EOF
  486. #include <ctype.h>
  487. int main() { exit(0); }
  488. int t() { 
  489. /* The GNU C library defines this for functions which it implements
  490.     to always fail with ENOSYS.  Some functions are actually named
  491.     something starting with __ and the normal name is an alias.  */
  492. #if defined (__stub_random) || defined (__stub___random)
  493. choke me
  494. #else
  495. /* Override any gcc2 internal prototype to avoid an error.  */
  496. extern char random(); random();
  497. #endif
  498.  }
  499. EOF
  500. if eval $compile; then
  501.   :
  502. else
  503.   LIBOBJS="$LIBOBJS random.o"
  504. fi
  505. rm -f conftest*
  506.  
  507.  
  508.  
  509. #------------------------------------------------------------------------------
  510. #       Supply substitutes for missing POSIX header files.  Special
  511. #       notes:
  512. #           - Sprite's dirent.h exists but is bogus.
  513. #           - stdlib.h doesn't define strtol, strtoul, or
  514. #             strtod insome versions of SunOS
  515. #           - some versions of string.h don't declare procedures such
  516. #             as strstr
  517. #------------------------------------------------------------------------------
  518.  
  519. echo checking for unistd.h
  520. cat > conftest.c <<EOF
  521. #include <unistd.h>
  522. EOF
  523. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  524. if test -z "$err"; then
  525.   
  526. {
  527. test -n "$verbose" && \
  528. echo "    defining HAVE_UNISTD_H"
  529. DEFS="$DEFS -DHAVE_UNISTD_H=1"
  530. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNISTD_H\${SEDdB}HAVE_UNISTD_H\${SEDdC}1\${SEDdD}
  531. \${SEDuA}HAVE_UNISTD_H\${SEDuB}HAVE_UNISTD_H\${SEDuC}1\${SEDuD}
  532. \${SEDeA}HAVE_UNISTD_H\${SEDeB}HAVE_UNISTD_H\${SEDeC}1\${SEDeD}
  533. "
  534. }
  535.  
  536. fi
  537. rm -f conftest*
  538.  
  539. echo checking for dirent.h
  540. cat > conftest.c <<EOF
  541. #include <sys/types.h>
  542. #include <dirent.h>
  543. int main() { exit(0); }
  544. int t() { 
  545. DIR *d;
  546. struct dirent *entryPtr;
  547. char *p;
  548. d = opendir("foobar");
  549. entryPtr = readdir(d);
  550. p = entryPtr->d_name;
  551. closedir(d);
  552.  }
  553. EOF
  554. if eval $compile; then
  555.   :
  556. else
  557.   
  558. {
  559. test -n "$verbose" && \
  560. echo "    defining NO_DIRENT_H"
  561. DEFS="$DEFS -DNO_DIRENT_H=1"
  562. SEDDEFS="${SEDDEFS}\${SEDdA}NO_DIRENT_H\${SEDdB}NO_DIRENT_H\${SEDdC}1\${SEDdD}
  563. \${SEDuA}NO_DIRENT_H\${SEDuB}NO_DIRENT_H\${SEDuC}1\${SEDuD}
  564. \${SEDeA}NO_DIRENT_H\${SEDeB}NO_DIRENT_H\${SEDeC}1\${SEDeD}
  565. "
  566. }
  567.  
  568. fi
  569. rm -f conftest*
  570.  
  571.  
  572. echo '#include <
  573. {
  574. test -n "$verbose" && \
  575. echo "    defining NO_DIRENT_H"
  576. DEFS="$DEFS -DNO_DIRENT_H=1"
  577. SEDDEFS="${SEDDEFS}\${SEDdA}NO_DIRENT_H\${SEDdB}NO_DIRENT_H\${SEDdC}1\${SEDdD}
  578. \${SEDuA}NO_DIRENT_H\${SEDuB}NO_DIRENT_H\${SEDuC}1\${SEDuD}
  579. \${SEDeA}NO_DIRENT_H\${SEDeB}NO_DIRENT_H\${SEDeC}1\${SEDeD}
  580. "
  581. }
  582. >' > conftest.c
  583. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  584. if egrep "Sprite version.* NOT POSIX" conftest.out >/dev/null 2>&1; then
  585.   :
  586. fi
  587. rm -f conftest*
  588.  
  589. echo checking for float.h
  590. cat > conftest.c <<EOF
  591. #include <float.h>
  592. EOF
  593. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  594. if test -z "$err"; then
  595.   :
  596. else
  597.   
  598. {
  599. test -n "$verbose" && \
  600. echo "    defining NO_FLOAT_H"
  601. DEFS="$DEFS -DNO_FLOAT_H=1"
  602. SEDDEFS="${SEDDEFS}\${SEDdA}NO_FLOAT_H\${SEDdB}NO_FLOAT_H\${SEDdC}1\${SEDdD}
  603. \${SEDuA}NO_FLOAT_H\${SEDuB}NO_FLOAT_H\${SEDuC}1\${SEDuD}
  604. \${SEDeA}NO_FLOAT_H\${SEDeB}NO_FLOAT_H\${SEDeC}1\${SEDeD}
  605. "
  606. }
  607.  
  608. fi
  609. rm -f conftest*
  610.  
  611. echo checking for values.h
  612. cat > conftest.c <<EOF
  613. #include <values.h>
  614. EOF
  615. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  616. if test -z "$err"; then
  617.   :
  618. else
  619.   
  620. {
  621. test -n "$verbose" && \
  622. echo "    defining NO_VALUES_H"
  623. DEFS="$DEFS -DNO_VALUES_H=1"
  624. SEDDEFS="${SEDDEFS}\${SEDdA}NO_VALUES_H\${SEDdB}NO_VALUES_H\${SEDdC}1\${SEDdD}
  625. \${SEDuA}NO_VALUES_H\${SEDuB}NO_VALUES_H\${SEDuC}1\${SEDuD}
  626. \${SEDeA}NO_VALUES_H\${SEDeB}NO_VALUES_H\${SEDeC}1\${SEDeD}
  627. "
  628. }
  629.  
  630. fi
  631. rm -f conftest*
  632.  
  633. echo checking for limits.h
  634. cat > conftest.c <<EOF
  635. #include <limits.h>
  636. EOF
  637. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  638. if test -z "$err"; then
  639.   :
  640. else
  641.   
  642. {
  643. test -n "$verbose" && \
  644. echo "    defining NO_LIMITS_H"
  645. DEFS="$DEFS -DNO_LIMITS_H=1"
  646. SEDDEFS="${SEDDEFS}\${SEDdA}NO_LIMITS_H\${SEDdB}NO_LIMITS_H\${SEDdC}1\${SEDdD}
  647. \${SEDuA}NO_LIMITS_H\${SEDuB}NO_LIMITS_H\${SEDuC}1\${SEDuD}
  648. \${SEDeA}NO_LIMITS_H\${SEDeB}NO_LIMITS_H\${SEDeC}1\${SEDeD}
  649. "
  650. }
  651.  
  652. fi
  653. rm -f conftest*
  654.  
  655. echo checking for stdlib.h
  656. cat > conftest.c <<EOF
  657. #include <stdlib.h>
  658. EOF
  659. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  660. if test -z "$err"; then
  661.   :
  662. else
  663.   
  664. {
  665. test -n "$verbose" && \
  666. echo "    defining NO_STDLIB_H"
  667. DEFS="$DEFS -DNO_STDLIB_H=1"
  668. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STDLIB_H\${SEDdB}NO_STDLIB_H\${SEDdC}1\${SEDdD}
  669. \${SEDuA}NO_STDLIB_H\${SEDuB}NO_STDLIB_H\${SEDuC}1\${SEDuD}
  670. \${SEDeA}NO_STDLIB_H\${SEDeB}NO_STDLIB_H\${SEDeC}1\${SEDeD}
  671. "
  672. }
  673.  
  674. fi
  675. rm -f conftest*
  676.  
  677. echo '#include <stdlib.h>' > conftest.c
  678. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  679. if egrep "strtol" conftest.out >/dev/null 2>&1; then
  680.   :
  681. else
  682.   
  683. {
  684. test -n "$verbose" && \
  685. echo "    defining NO_STDLIB_H"
  686. DEFS="$DEFS -DNO_STDLIB_H=1"
  687. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STDLIB_H\${SEDdB}NO_STDLIB_H\${SEDdC}1\${SEDdD}
  688. \${SEDuA}NO_STDLIB_H\${SEDuB}NO_STDLIB_H\${SEDuC}1\${SEDuD}
  689. \${SEDeA}NO_STDLIB_H\${SEDeB}NO_STDLIB_H\${SEDeC}1\${SEDeD}
  690. "
  691. }
  692.  
  693. fi
  694. rm -f conftest*
  695.  
  696. echo '#include <stdlib.h>' > conftest.c
  697. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  698. if egrep "strtoul" conftest.out >/dev/null 2>&1; then
  699.   :
  700. else
  701.   
  702. {
  703. test -n "$verbose" && \
  704. echo "    defining NO_STDLIB_H"
  705. DEFS="$DEFS -DNO_STDLIB_H=1"
  706. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STDLIB_H\${SEDdB}NO_STDLIB_H\${SEDdC}1\${SEDdD}
  707. \${SEDuA}NO_STDLIB_H\${SEDuB}NO_STDLIB_H\${SEDuC}1\${SEDuD}
  708. \${SEDeA}NO_STDLIB_H\${SEDeB}NO_STDLIB_H\${SEDeC}1\${SEDeD}
  709. "
  710. }
  711.  
  712. fi
  713. rm -f conftest*
  714.  
  715. echo '#include <stdlib.h>' > conftest.c
  716. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  717. if egrep "strtod" conftest.out >/dev/null 2>&1; then
  718.   :
  719. else
  720.   
  721. {
  722. test -n "$verbose" && \
  723. echo "    defining NO_STDLIB_H"
  724. DEFS="$DEFS -DNO_STDLIB_H=1"
  725. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STDLIB_H\${SEDdB}NO_STDLIB_H\${SEDdC}1\${SEDdD}
  726. \${SEDuA}NO_STDLIB_H\${SEDuB}NO_STDLIB_H\${SEDuC}1\${SEDuD}
  727. \${SEDeA}NO_STDLIB_H\${SEDeB}NO_STDLIB_H\${SEDeC}1\${SEDeD}
  728. "
  729. }
  730.  
  731. fi
  732. rm -f conftest*
  733.  
  734. echo checking for string.h
  735. cat > conftest.c <<EOF
  736. #include <string.h>
  737. EOF
  738. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  739. if test -z "$err"; then
  740.   :
  741. else
  742.   
  743. {
  744. test -n "$verbose" && \
  745. echo "    defining NO_STRING_H"
  746. DEFS="$DEFS -DNO_STRING_H=1"
  747. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STRING_H\${SEDdB}NO_STRING_H\${SEDdC}1\${SEDdD}
  748. \${SEDuA}NO_STRING_H\${SEDuB}NO_STRING_H\${SEDuC}1\${SEDuD}
  749. \${SEDeA}NO_STRING_H\${SEDeB}NO_STRING_H\${SEDeC}1\${SEDeD}
  750. "
  751. }
  752.  
  753. fi
  754. rm -f conftest*
  755.  
  756. echo '#include <string.h>' > conftest.c
  757. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  758. if egrep "strstr" conftest.out >/dev/null 2>&1; then
  759.   :
  760. else
  761.   
  762. {
  763. test -n "$verbose" && \
  764. echo "    defining NO_STRING_H"
  765. DEFS="$DEFS -DNO_STRING_H=1"
  766. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STRING_H\${SEDdB}NO_STRING_H\${SEDdC}1\${SEDdD}
  767. \${SEDuA}NO_STRING_H\${SEDuB}NO_STRING_H\${SEDuC}1\${SEDuD}
  768. \${SEDeA}NO_STRING_H\${SEDeB}NO_STRING_H\${SEDeC}1\${SEDeD}
  769. "
  770. }
  771.  
  772. fi
  773. rm -f conftest*
  774.  
  775. echo '#include <string.h>' > conftest.c
  776. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  777. if egrep "strerror" conftest.out >/dev/null 2>&1; then
  778.   :
  779. else
  780.   
  781. {
  782. test -n "$verbose" && \
  783. echo "    defining NO_STRING_H"
  784. DEFS="$DEFS -DNO_STRING_H=1"
  785. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STRING_H\${SEDdB}NO_STRING_H\${SEDdC}1\${SEDdD}
  786. \${SEDuA}NO_STRING_H\${SEDuB}NO_STRING_H\${SEDuC}1\${SEDuD}
  787. \${SEDeA}NO_STRING_H\${SEDeB}NO_STRING_H\${SEDeC}1\${SEDeD}
  788. "
  789. }
  790.  
  791. fi
  792. rm -f conftest*
  793.  
  794. echo checking for sys/time.h
  795. cat > conftest.c <<EOF
  796. #include <sys/time.h>
  797. EOF
  798. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  799. if test -z "$err"; then
  800.   :
  801. else
  802.   
  803. {
  804. test -n "$verbose" && \
  805. echo "    defining NO_SYS_TIME_H"
  806. DEFS="$DEFS -DNO_SYS_TIME_H=1"
  807. SEDDEFS="${SEDDEFS}\${SEDdA}NO_SYS_TIME_H\${SEDdB}NO_SYS_TIME_H\${SEDdC}1\${SEDdD}
  808. \${SEDuA}NO_SYS_TIME_H\${SEDuB}NO_SYS_TIME_H\${SEDuC}1\${SEDuD}
  809. \${SEDeA}NO_SYS_TIME_H\${SEDeB}NO_SYS_TIME_H\${SEDeC}1\${SEDeD}
  810. "
  811. }
  812.  
  813. fi
  814. rm -f conftest*
  815.  
  816. echo checking for sys/wait.h
  817. cat > conftest.c <<EOF
  818. #include <sys/wait.h>
  819. EOF
  820. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  821. if test -z "$err"; then
  822.   :
  823. else
  824.   
  825. {
  826. test -n "$verbose" && \
  827. echo "    defining NO_SYS_WAIT_H"
  828. DEFS="$DEFS -DNO_SYS_WAIT_H=1"
  829. SEDDEFS="${SEDDEFS}\${SEDdA}NO_SYS_WAIT_H\${SEDdB}NO_SYS_WAIT_H\${SEDdC}1\${SEDdD}
  830. \${SEDuA}NO_SYS_WAIT_H\${SEDuB}NO_SYS_WAIT_H\${SEDuC}1\${SEDuD}
  831. \${SEDeA}NO_SYS_WAIT_H\${SEDeB}NO_SYS_WAIT_H\${SEDeC}1\${SEDeD}
  832. "
  833. }
  834.  
  835. fi
  836. rm -f conftest*
  837.  
  838. echo checking for sys/socket.h
  839. cat > conftest.c <<EOF
  840. #include <sys/socket.h>
  841. EOF
  842. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  843. if test -z "$err"; then
  844.   :
  845. else
  846.   
  847. {
  848. test -n "$verbose" && \
  849. echo "    defining NO_SYS_SOCKET_H"
  850. DEFS="$DEFS -DNO_SYS_SOCKET_H=1"
  851. SEDDEFS="${SEDDEFS}\${SEDdA}NO_SYS_SOCKET_H\${SEDdB}NO_SYS_SOCKET_H\${SEDdC}1\${SEDdD}
  852. \${SEDuA}NO_SYS_SOCKET_H\${SEDuB}NO_SYS_SOCKET_H\${SEDuC}1\${SEDuD}
  853. \${SEDeA}NO_SYS_SOCKET_H\${SEDeB}NO_SYS_SOCKET_H\${SEDeC}1\${SEDeD}
  854. "
  855. }
  856.  
  857. fi
  858. rm -f conftest*
  859.  
  860.  
  861. #------------------------------------------------------------------------------
  862. #       Include sys/select.h if it exists and if it supplies things
  863. #       that appear to be useful.  This appears to be true only on
  864. #       the RS/6000 under AIX.  Some systems like OSF/1 have a
  865. #       sys/select.h that's of no use, and other systems like SCO
  866. #       UNIX have a sys/select.h that's pernicious.
  867. #------------------------------------------------------------------------------
  868.  
  869. echo checking for sys/select.h
  870. echo '#include <sys/select.h>' > conftest.c
  871. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  872. if egrep "fd_mask" conftest.out >/dev/null 2>&1; then
  873.   
  874. {
  875. test -n "$verbose" && \
  876. echo "    defining HAVE_SYS_SELECT_H"
  877. DEFS="$DEFS -DHAVE_SYS_SELECT_H=1"
  878. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_SELECT_H\${SEDdB}HAVE_SYS_SELECT_H\${SEDdC}1\${SEDdD}
  879. \${SEDuA}HAVE_SYS_SELECT_H\${SEDuB}HAVE_SYS_SELECT_H\${SEDuC}1\${SEDuD}
  880. \${SEDeA}HAVE_SYS_SELECT_H\${SEDeB}HAVE_SYS_SELECT_H\${SEDeC}1\${SEDeD}
  881. "
  882. }
  883.  
  884. fi
  885. rm -f conftest*
  886.  
  887.  
  888. #------------------------------------------------------------------------------
  889. #       Check for missing typedefs.
  890. #------------------------------------------------------------------------------
  891.  
  892. echo checking for pid_t in sys/types.h
  893. echo '#include <sys/types.h>' > conftest.c
  894. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  895. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  896.   :
  897. else
  898.   
  899. {
  900. test -n "$verbose" && \
  901. echo "    defining pid_t to be int"
  902. DEFS="$DEFS -Dpid_t=int"
  903. SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD}
  904. \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD}
  905. \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD}
  906. "
  907. }
  908.  
  909. fi
  910. rm -f conftest*
  911.  
  912. echo checking for uid_t in sys/types.h
  913. echo '#include <sys/types.h>' > conftest.c
  914. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  915. if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  916.   :
  917. else
  918.   
  919. {
  920. test -n "$verbose" && \
  921. echo "    defining uid_t to be int"
  922. DEFS="$DEFS -Duid_t=int"
  923. SEDDEFS="${SEDDEFS}\${SEDdA}uid_t\${SEDdB}uid_t\${SEDdC}int\${SEDdD}
  924. \${SEDuA}uid_t\${SEDuB}uid_t\${SEDuC}int\${SEDuD}
  925. \${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD}
  926. "
  927. }
  928.  
  929. {
  930. test -n "$verbose" && \
  931. echo "    defining gid_t to be int"
  932. DEFS="$DEFS -Dgid_t=int"
  933. SEDDEFS="${SEDDEFS}\${SEDdA}gid_t\${SEDdB}gid_t\${SEDdC}int\${SEDdD}
  934. \${SEDuA}gid_t\${SEDuB}gid_t\${SEDuC}int\${SEDuD}
  935. \${SEDeA}gid_t\${SEDeB}gid_t\${SEDeC}int\${SEDeD}
  936. "
  937. }
  938.  
  939. fi
  940. rm -f conftest*
  941.  
  942. echo checking for type of array argument to getgroups
  943. prog='/* Thanks to Mike Rendell for this test.  */
  944. #include <sys/types.h>
  945. #define NGID 256
  946. #undef MAX
  947. #define MAX(x,y) ((x) > (y) ? (x) : (y))
  948. main()
  949. {
  950.   gid_t gidset[NGID];
  951.   int i, n;
  952.   union { gid_t gval; long lval; }  val;
  953.  
  954.   val.lval = -1;
  955.   for (i = 0; i < NGID; i++)
  956.     gidset[i] = val.gval;
  957.   n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
  958.                  gidset);
  959.   /* Exit non-zero if getgroups seems to require an array of ints.  This
  960.      happens when gid_t is short but getgroups modifies an array of ints.  */
  961.   exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
  962. }'
  963. cat > conftest.c <<EOF
  964. $prog
  965. EOF
  966. eval $compile
  967. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  968.   
  969. {
  970. test -n "$verbose" && \
  971. echo "    defining GETGROUPS_T to be gid_t"
  972. DEFS="$DEFS -DGETGROUPS_T=gid_t"
  973. SEDDEFS="${SEDDEFS}\${SEDdA}GETGROUPS_T\${SEDdB}GETGROUPS_T\${SEDdC}gid_t\${SEDdD}
  974. \${SEDuA}GETGROUPS_T\${SEDuB}GETGROUPS_T\${SEDuC}gid_t\${SEDuD}
  975. \${SEDeA}GETGROUPS_T\${SEDeB}GETGROUPS_T\${SEDeC}gid_t\${SEDeD}
  976. "
  977. }
  978.  
  979. else
  980.   
  981. {
  982. test -n "$verbose" && \
  983. echo "    defining GETGROUPS_T to be int"
  984. DEFS="$DEFS -DGETGROUPS_T=int"
  985. SEDDEFS="${SEDDEFS}\${SEDdA}GETGROUPS_T\${SEDdB}GETGROUPS_T\${SEDdC}int\${SEDdD}
  986. \${SEDuA}GETGROUPS_T\${SEDuB}GETGROUPS_T\${SEDuC}int\${SEDuD}
  987. \${SEDeA}GETGROUPS_T\${SEDeB}GETGROUPS_T\${SEDeC}int\${SEDeD}
  988. "
  989. }
  990.  
  991. fi
  992. rm -f conftest*
  993.  
  994. echo checking for uid_t in sys/types.h
  995. echo '#include <sys/types.h>' > conftest.c
  996. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  997. if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  998.   :
  999. else
  1000.   
  1001. {
  1002. test -n "$verbose" && \
  1003. echo "    defining uid_t to be int"
  1004. DEFS="$DEFS -Duid_t=int"
  1005. SEDDEFS="${SEDDEFS}\${SEDdA}uid_t\${SEDdB}uid_t\${SEDdC}int\${SEDdD}
  1006. \${SEDuA}uid_t\${SEDuB}uid_t\${SEDuC}int\${SEDuD}
  1007. \${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD}
  1008. "
  1009. }
  1010.  
  1011. {
  1012. test -n "$verbose" && \
  1013. echo "    defining gid_t to be int"
  1014. DEFS="$DEFS -Dgid_t=int"
  1015. SEDDEFS="${SEDDEFS}\${SEDdA}gid_t\${SEDdB}gid_t\${SEDdC}int\${SEDdD}
  1016. \${SEDuA}gid_t\${SEDuB}gid_t\${SEDuC}int\${SEDuD}
  1017. \${SEDeA}gid_t\${SEDeB}gid_t\${SEDeC}int\${SEDeD}
  1018. "
  1019. }
  1020.  
  1021. fi
  1022. rm -f conftest*
  1023.  
  1024. echo checking for mode_t in sys/types.h
  1025. echo '#include <sys/types.h>' > conftest.c
  1026. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  1027. if egrep "mode_t" conftest.out >/dev/null 2>&1; then
  1028.   :
  1029. else
  1030.   
  1031. {
  1032. test -n "$verbose" && \
  1033. echo "    defining mode_t to be int"
  1034. DEFS="$DEFS -Dmode_t=int"
  1035. SEDDEFS="${SEDDEFS}\${SEDdA}mode_t\${SEDdB}mode_t\${SEDdC}int\${SEDdD}
  1036. \${SEDuA}mode_t\${SEDuB}mode_t\${SEDuC}int\${SEDuD}
  1037. \${SEDeA}mode_t\${SEDeB}mode_t\${SEDeC}int\${SEDeD}
  1038. "
  1039. }
  1040.  
  1041. fi
  1042. rm -f conftest*
  1043.  
  1044. echo checking for time_t
  1045. cat > conftest.c <<EOF
  1046. #include <sys/types.h>
  1047. int main() { exit(0); }
  1048. int t() {  }
  1049. EOF
  1050. if eval $compile; then
  1051.   :
  1052. else
  1053.   
  1054. {
  1055. test -n "$verbose" && \
  1056. echo "    defining time_t to be long"
  1057. DEFS="$DEFS -Dtime_t=long"
  1058. SEDDEFS="${SEDDEFS}\${SEDdA}time_t\${SEDdB}time_t\${SEDdC}long\${SEDdD}
  1059. \${SEDuA}time_t\${SEDuB}time_t\${SEDuC}long\${SEDuD}
  1060. \${SEDeA}time_t\${SEDeB}time_t\${SEDeC}long\${SEDeD}
  1061. "
  1062. }
  1063.  
  1064. fi
  1065. rm -f conftest*
  1066.  
  1067.  
  1068. #------------------------------------------------------------------------------
  1069. #       Make "const" work no matter what.
  1070. #------------------------------------------------------------------------------
  1071.  
  1072. prog='/* Ultrix mips cc rejects this.  */
  1073. typedef int charset[2]; const charset x;
  1074. /* SunOS 4.1.1 cc rejects this.  */
  1075. char const *const *ccp;
  1076. char **p;
  1077. /* AIX XL C 1.02.0.0 rejects this.
  1078.    It does not let you subtract one const X* pointer from another in an arm
  1079.    of an if-expression whose if-part is not a constant expression */
  1080. const char *g = "string";
  1081. ccp = &g + (g ? g-g : 0);
  1082. /* HPUX 7.0 cc rejects these. */
  1083. ++ccp;
  1084. p = (char**) ccp;
  1085. ccp = (char const *const *) p;
  1086. { /* SCO 3.2v4 cc rejects this.  */
  1087.   char *t;
  1088.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  1089.  
  1090.   *t++ = 0;
  1091. }
  1092. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  1093.   int x[] = {25,17};
  1094.   const int *foo = &x[0];
  1095.   ++foo;
  1096. }
  1097. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  1098.   typedef const int *iptr;
  1099.   iptr p = 0;
  1100.   ++p;
  1101. }
  1102. { /* AIX XL C 1.02.0.0 rejects this saying
  1103.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  1104.   struct s { int j; const int *ap[3]; };
  1105.   struct s *b; b->j = 5;
  1106. }'
  1107. echo checking for working const
  1108. cat > conftest.c <<EOF
  1109.  
  1110. int main() { exit(0); }
  1111. int t() { $prog }
  1112. EOF
  1113. if eval $compile; then
  1114.   :
  1115. else
  1116.   
  1117. {
  1118. test -n "$verbose" && \
  1119. echo "    defining const to be empty"
  1120. DEFS="$DEFS -Dconst="
  1121. SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
  1122. \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
  1123. \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
  1124. "
  1125. }
  1126.  
  1127. fi
  1128. rm -f conftest*
  1129.  
  1130.  
  1131. #------------------------------------------------------------------------------
  1132. #       What type do signals return?
  1133. #------------------------------------------------------------------------------
  1134.  
  1135. echo checking for return type of signal handlers
  1136. cat > conftest.c <<EOF
  1137. #include <sys/types.h>
  1138. #include <signal.h>
  1139. #ifdef signal
  1140. #undef signal
  1141. #endif
  1142. extern void (*signal ()) ();
  1143. int main() { exit(0); }
  1144. int t() { int i; }
  1145. EOF
  1146. if eval $compile; then
  1147.   
  1148. {
  1149. test -n "$verbose" && \
  1150. echo "    defining RETSIGTYPE to be void"
  1151. DEFS="$DEFS -DRETSIGTYPE=void"
  1152. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}void\${SEDdD}
  1153. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}void\${SEDuD}
  1154. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}void\${SEDeD}
  1155. "
  1156. }
  1157.  
  1158. else
  1159.   
  1160. {
  1161. test -n "$verbose" && \
  1162. echo "    defining RETSIGTYPE to be int"
  1163. DEFS="$DEFS -DRETSIGTYPE=int"
  1164. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD}
  1165. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD}
  1166. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD}
  1167. "
  1168. }
  1169.  
  1170. fi
  1171. rm -f conftest*
  1172.  
  1173.  
  1174.  
  1175.  
  1176. #------------------------------------------------------------------------------
  1177. #       Find out all about time handling differences.
  1178. #------------------------------------------------------------------------------
  1179.  
  1180. echo checking for whether time.h and sys/time.h may both be included
  1181. cat > conftest.c <<EOF
  1182. #include <sys/types.h>
  1183. #include <sys/time.h>
  1184. #include <time.h>
  1185. int main() { exit(0); }
  1186. int t() { struct tm *tp; }
  1187. EOF
  1188. if eval $compile; then
  1189.   
  1190. {
  1191. test -n "$verbose" && \
  1192. echo "    defining TIME_WITH_SYS_TIME"
  1193. DEFS="$DEFS -DTIME_WITH_SYS_TIME=1"
  1194. SEDDEFS="${SEDDEFS}\${SEDdA}TIME_WITH_SYS_TIME\${SEDdB}TIME_WITH_SYS_TIME\${SEDdC}1\${SEDdD}
  1195. \${SEDuA}TIME_WITH_SYS_TIME\${SEDuB}TIME_WITH_SYS_TIME\${SEDuC}1\${SEDuD}
  1196. \${SEDeA}TIME_WITH_SYS_TIME\${SEDeB}TIME_WITH_SYS_TIME\${SEDeC}1\${SEDeD}
  1197. "
  1198. }
  1199.  
  1200. fi
  1201. rm -f conftest*
  1202.  
  1203. echo checking for struct tm in time.h
  1204. cat > conftest.c <<EOF
  1205. #include <sys/types.h>
  1206. #include <time.h>
  1207. int main() { exit(0); }
  1208. int t() { struct tm *tp; }
  1209. EOF
  1210. if eval $compile; then
  1211.   :
  1212. else
  1213.   
  1214. {
  1215. test -n "$verbose" && \
  1216. echo "    defining TM_IN_SYS_TIME"
  1217. DEFS="$DEFS -DTM_IN_SYS_TIME=1"
  1218. SEDDEFS="${SEDDEFS}\${SEDdA}TM_IN_SYS_TIME\${SEDdB}TM_IN_SYS_TIME\${SEDdC}1\${SEDdD}
  1219. \${SEDuA}TM_IN_SYS_TIME\${SEDuB}TM_IN_SYS_TIME\${SEDuC}1\${SEDuD}
  1220. \${SEDeA}TM_IN_SYS_TIME\${SEDeB}TM_IN_SYS_TIME\${SEDeC}1\${SEDeD}
  1221. "
  1222. }
  1223.  
  1224. fi
  1225. rm -f conftest*
  1226.  
  1227. decl='#include <sys/types.h>
  1228. '
  1229. case "$DEFS" in
  1230.   *TM_IN_SYS_TIME*) decl="$decl
  1231. #include <sys/time.h>
  1232. " ;;
  1233.   *) decl="$decl
  1234. #include <time.h>
  1235. " ;;
  1236. esac
  1237. echo checking for tm_zone in struct tm
  1238. cat > conftest.c <<EOF
  1239. $decl
  1240. int main() { exit(0); }
  1241. int t() { struct tm tm; tm.tm_zone; }
  1242. EOF
  1243. if eval $compile; then
  1244.   
  1245. {
  1246. test -n "$verbose" && \
  1247. echo "    defining HAVE_TM_ZONE"
  1248. DEFS="$DEFS -DHAVE_TM_ZONE=1"
  1249. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TM_ZONE\${SEDdB}HAVE_TM_ZONE\${SEDdC}1\${SEDdD}
  1250. \${SEDuA}HAVE_TM_ZONE\${SEDuB}HAVE_TM_ZONE\${SEDuC}1\${SEDuD}
  1251. \${SEDeA}HAVE_TM_ZONE\${SEDeB}HAVE_TM_ZONE\${SEDeC}1\${SEDeD}
  1252. "
  1253. }
  1254.  
  1255. else
  1256.   no_tm_zone=1
  1257. fi
  1258. rm -f conftest*
  1259.  
  1260. if test -n "$no_tm_zone"; then
  1261. echo checking for tzname
  1262. cat > conftest.c <<EOF
  1263. #include <time.h>
  1264. #ifndef tzname /* For SGI.  */
  1265. extern char *tzname[]; /* RS6000 and others want it this way.  */
  1266. #endif
  1267. int main() { exit(0); }
  1268. int t() { atoi(*tzname); }
  1269. EOF
  1270. if eval $compile; then
  1271.   
  1272. {
  1273. test -n "$verbose" && \
  1274. echo "    defining HAVE_TZNAME"
  1275. DEFS="$DEFS -DHAVE_TZNAME=1"
  1276. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TZNAME\${SEDdB}HAVE_TZNAME\${SEDdC}1\${SEDdD}
  1277. \${SEDuA}HAVE_TZNAME\${SEDuB}HAVE_TZNAME\${SEDuC}1\${SEDuD}
  1278. \${SEDeA}HAVE_TZNAME\${SEDeB}HAVE_TZNAME\${SEDeC}1\${SEDeD}
  1279. "
  1280. }
  1281.  
  1282. fi
  1283. rm -f conftest*
  1284.  
  1285. fi
  1286.  
  1287.  
  1288. echo checking for tm_tzadj in struct tm
  1289. cat > conftest.c <<EOF
  1290. $decl
  1291. int main() { exit(0); }
  1292. int t() { struct tm tm; tm.tm_tzadj; }
  1293. EOF
  1294. if eval $compile; then
  1295.   
  1296. {
  1297. test -n "$verbose" && \
  1298. echo "    defining HAVE_TM_TZADJ"
  1299. DEFS="$DEFS -DHAVE_TM_TZADJ=1"
  1300. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TM_TZADJ\${SEDdB}HAVE_TM_TZADJ\${SEDdC}1\${SEDdD}
  1301. \${SEDuA}HAVE_TM_TZADJ\${SEDuB}HAVE_TM_TZADJ\${SEDuC}1\${SEDuD}
  1302. \${SEDeA}HAVE_TM_TZADJ\${SEDeB}HAVE_TM_TZADJ\${SEDeC}1\${SEDeD}
  1303. "
  1304. }
  1305.  
  1306. fi
  1307. rm -f conftest*
  1308.  
  1309.  
  1310. echo checking for tm_gmtoff in struct tm
  1311. cat > conftest.c <<EOF
  1312. $decl
  1313. int main() { exit(0); }
  1314. int t() { struct tm tm; tm.tm_gmtoff; }
  1315. EOF
  1316. if eval $compile; then
  1317.   
  1318. {
  1319. test -n "$verbose" && \
  1320. echo "    defining HAVE_TM_GMTOFF"
  1321. DEFS="$DEFS -DHAVE_TM_GMTOFF=1"
  1322. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TM_GMTOFF\${SEDdB}HAVE_TM_GMTOFF\${SEDdC}1\${SEDdD}
  1323. \${SEDuA}HAVE_TM_GMTOFF\${SEDuB}HAVE_TM_GMTOFF\${SEDuC}1\${SEDuD}
  1324. \${SEDeA}HAVE_TM_GMTOFF\${SEDeB}HAVE_TM_GMTOFF\${SEDeC}1\${SEDeD}
  1325. "
  1326. }
  1327.  
  1328. fi
  1329. rm -f conftest*
  1330.  
  1331.  
  1332. for func in gettimeofday
  1333. do
  1334. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  1335. echo checking for ${func}
  1336. cat > conftest.c <<EOF
  1337. #include <ctype.h>
  1338. int main() { exit(0); }
  1339. int t() { 
  1340. /* The GNU C library defines this for functions which it implements
  1341.     to always fail with ENOSYS.  Some functions are actually named
  1342.     something starting with __ and the normal name is an alias.  */
  1343. #if defined (__stub_${func}) || defined (__stub___${func})
  1344. choke me
  1345. #else
  1346. /* Override any gcc2 internal prototype to avoid an error.  */
  1347. extern char ${func}(); ${func}();
  1348. #endif
  1349.  }
  1350. EOF
  1351. if eval $compile; then
  1352.   {
  1353. test -n "$verbose" && \
  1354. echo "    defining ${trfunc}"
  1355. DEFS="$DEFS -D${trfunc}=1"
  1356. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  1357. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  1358. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  1359. "
  1360. }
  1361.  
  1362. fi
  1363. rm -f conftest*
  1364. done
  1365.  
  1366.  
  1367. echo checking for timezone variable
  1368. cat > conftest.c <<EOF
  1369.  
  1370. int main() { exit(0); }
  1371. int t() { 
  1372. extern long timezone;
  1373. timezone += 1;
  1374. exit (0);
  1375.  }
  1376. EOF
  1377. if eval $compile; then
  1378.   
  1379. {
  1380. test -n "$verbose" && \
  1381. echo "    defining HAVE_TIMEZONE_VAR"
  1382. DEFS="$DEFS -DHAVE_TIMEZONE_VAR=1"
  1383. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TIMEZONE_VAR\${SEDdB}HAVE_TIMEZONE_VAR\${SEDdC}1\${SEDdD}
  1384. \${SEDuA}HAVE_TIMEZONE_VAR\${SEDuB}HAVE_TIMEZONE_VAR\${SEDuC}1\${SEDuD}
  1385. \${SEDeA}HAVE_TIMEZONE_VAR\${SEDeB}HAVE_TIMEZONE_VAR\${SEDeC}1\${SEDeD}
  1386. "
  1387. }
  1388.  
  1389. fi
  1390. rm -f conftest*
  1391.  
  1392.  
  1393. #------------------------------------------------------------------------------
  1394. #     Test to see if "times" returns a status or the amount of
  1395. #     elapsed real time.
  1396. #------------------------------------------------------------------------------
  1397.  
  1398. echo "checking to see if 'times' returns the elapsed real time"
  1399. cat > conftest.c <<EOF
  1400.  
  1401. #include <sys/types.h>
  1402. #include <sys/times.h>
  1403. main() {
  1404. struct tms cpu;
  1405. times (&cpu);
  1406. sleep (2);
  1407. if (times (&cpu) > 0)
  1408.      exit (0);
  1409. else 
  1410.      exit (1);
  1411. }
  1412.  
  1413. EOF
  1414. eval $compile
  1415. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1416.   
  1417. {
  1418. test -n "$verbose" && \
  1419. echo "    defining TIMES_RETS_REAL_TIME"
  1420. DEFS="$DEFS -DTIMES_RETS_REAL_TIME=1"
  1421. SEDDEFS="${SEDDEFS}\${SEDdA}TIMES_RETS_REAL_TIME\${SEDdB}TIMES_RETS_REAL_TIME\${SEDdC}1\${SEDdD}
  1422. \${SEDuA}TIMES_RETS_REAL_TIME\${SEDuB}TIMES_RETS_REAL_TIME\${SEDuC}1\${SEDuD}
  1423. \${SEDeA}TIMES_RETS_REAL_TIME\${SEDeB}TIMES_RETS_REAL_TIME\${SEDeC}1\${SEDeD}
  1424. "
  1425. }
  1426.  
  1427. fi
  1428. rm -f conftest*
  1429.  
  1430. #------------------------------------------------------------------------------
  1431. #     Determine if "." is used as separator for the manual directory
  1432. #     names.  i.e. man/man.1 vs man/man1
  1433. #------------------------------------------------------------------------------
  1434.  
  1435. echo "checking man directory/section separator (man/man.1 vs man/man1)"
  1436. mandirs="/usr/man/man.1 /usr/man/cat.1 /usr/share/man.1 /usr/share/man.1 
  1437.         /usr/man/cat.C"
  1438. gotdotdir="NO"
  1439. for d in $mandirs
  1440. do
  1441.     if test -d $d
  1442.     then
  1443.         gotdotdir="YES"
  1444.     fi
  1445. done
  1446.  
  1447. mandirs="/usr/man/man1   /usr/man/cat1   /usr/share/man1   /usr/share/man1
  1448.          /usr/man/man1.Z /usr/man/cat1.Z /usr/share/man1.Z /usr/share/man1.Z"
  1449. gotnodotdir="NO"
  1450. for d in $mandirs
  1451. do
  1452.     if test -d $d
  1453.     then
  1454.         gotnodotdir="YES"
  1455.     fi
  1456. done
  1457.  
  1458. if test $gotdotdir = YES -a $gotnodotdir = NO
  1459. then
  1460.     MAN_DIR_SEPARATOR="."
  1461. elif test $gotdotdir = NO -a $gotnodotdir = YES
  1462. then
  1463.     MAN_DIR_SEPARATOR=""
  1464. else
  1465.     MAN_DIR_SEPARATOR="."
  1466.     echo "WARNING: could not determine man directory/section separator"
  1467.     echo "         assuming man/man.1 (can override in Config.mk)."
  1468. fi
  1469.  
  1470.  
  1471. #------------------------------------------------------------------------------
  1472. #       The check below checks whether <sys/wait.h> defines the type
  1473. #       "union wait" correctly.  It's needed because of weirdness in
  1474. #       HP-UX where "union wait" is defined in both the BSD and SYS-V
  1475. #       environments.  Checking the usability of WIFEXITED seems to do
  1476. #       the trick.
  1477. #------------------------------------------------------------------------------
  1478.  
  1479. echo checking for union wait
  1480. cat > conftest.c <<EOF
  1481. #include <sys/types.h> 
  1482. #include <sys/wait.h>
  1483. int main() { exit(0); }
  1484. int t() { 
  1485. union wait x;
  1486. WIFEXITED(x);           /* Generates compiler error if WIFEXITED
  1487.                          * uses an int. */
  1488.  }
  1489. EOF
  1490. if eval $compile; then
  1491.   :
  1492. else
  1493.   
  1494. {
  1495. test -n "$verbose" && \
  1496. echo "    defining NO_UNION_WAIT"
  1497. DEFS="$DEFS -DNO_UNION_WAIT=1"
  1498. SEDDEFS="${SEDDEFS}\${SEDdA}NO_UNION_WAIT\${SEDdB}NO_UNION_WAIT\${SEDdC}1\${SEDdD}
  1499. \${SEDuA}NO_UNION_WAIT\${SEDuB}NO_UNION_WAIT\${SEDuC}1\${SEDuD}
  1500. \${SEDeA}NO_UNION_WAIT\${SEDeB}NO_UNION_WAIT\${SEDeC}1\${SEDeD}
  1501. "
  1502. }
  1503.  
  1504. fi
  1505. rm -f conftest*
  1506.  
  1507.  
  1508. #------------------------------------------------------------------------------
  1509. #       Add socket and nsl libraries, if found.  
  1510. #       Use C shared library if possible.
  1511. #------------------------------------------------------------------------------
  1512.  
  1513. LIBS_save="${LIBS}"
  1514. LIBS="${LIBS} -lsocket"
  1515. have_lib=""
  1516. echo checking for -lsocket
  1517. cat > conftest.c <<EOF
  1518.  
  1519. int main() { exit(0); }
  1520. int t() { main(); }
  1521. EOF
  1522. if eval $compile; then
  1523.   have_lib="1"
  1524. fi
  1525. rm -f conftest*
  1526. LIBS="${LIBS_save}"
  1527. if test -n "${have_lib}"; then
  1528.    :; LIBS="$LIBS -lsocket"
  1529. else
  1530.    :; 
  1531. fi
  1532.  
  1533. LIBS_save="${LIBS}"
  1534. LIBS="${LIBS} -lnsl"
  1535. have_lib=""
  1536. echo checking for -lnsl
  1537. cat > conftest.c <<EOF
  1538.  
  1539. int main() { exit(0); }
  1540. int t() { main(); }
  1541. EOF
  1542. if eval $compile; then
  1543.   have_lib="1"
  1544. fi
  1545. rm -f conftest*
  1546. LIBS="${LIBS_save}"
  1547. if test -n "${have_lib}"; then
  1548.    :; LIBS="$LIBS -lnsl"
  1549. else
  1550.    :; 
  1551. fi
  1552.  
  1553. LIBS_save="${LIBS}"
  1554. LIBS="${LIBS} -lc_s"
  1555. have_lib=""
  1556. echo checking for -lc_s
  1557. cat > conftest.c <<EOF
  1558.  
  1559. int main() { exit(0); }
  1560. int t() { main(); }
  1561. EOF
  1562. if eval $compile; then
  1563.   have_lib="1"
  1564. fi
  1565. rm -f conftest*
  1566. LIBS="${LIBS_save}"
  1567. if test -n "${have_lib}"; then
  1568.    :; LIBS="$LIBS -lc_s"
  1569. else
  1570.    :; 
  1571. fi
  1572.  
  1573.  
  1574. #------------------------------------------------------------------------------
  1575. #       Locate the X11 header files and the X11 library archive.
  1576. #------------------------------------------------------------------------------
  1577.  
  1578. echo checking for X11 header files
  1579. XINCLUDES="# no special path needed"
  1580. cat > conftest.c <<EOF
  1581. #include <X11/Intrinsic.h>
  1582. EOF
  1583. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  1584. if test -z "$err"; then
  1585.   :
  1586. else
  1587.   XINCLUDES="nope"
  1588. fi
  1589. rm -f conftest*
  1590. if test "$XINCLUDES" = nope; then
  1591.     dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include"
  1592.     for i in $dirs ; do
  1593.         if test -r $i/X11/Intrinsic.h; then
  1594.             XINCLUDES=" -I$i"
  1595.         fi
  1596.     done
  1597. fi
  1598. if test "$XINCLUDES" = nope; then
  1599.   echo "Warning:  couldn't find any X11 include files."
  1600.   echo "          set XINCLUDES in Config.mk"
  1601.   XINCLUDES="# no include files found"
  1602. fi
  1603.  
  1604.  
  1605. echo "checking for X11 library archive"
  1606. LIBS_save="${LIBS}"
  1607. LIBS="${LIBS} -lX11_s"
  1608. have_lib=""
  1609. echo checking for -lX11_s
  1610. cat > conftest.c <<EOF
  1611.  
  1612. int main() { exit(0); }
  1613. int t() { main(); }
  1614. EOF
  1615. if eval $compile; then
  1616.   have_lib="1"
  1617. fi
  1618. rm -f conftest*
  1619. LIBS="${LIBS_save}"
  1620. if test -n "${have_lib}"; then
  1621.    :; XLIBSW="-lX11_s"
  1622. else
  1623.    :; 
  1624. fi
  1625.  
  1626. LIBS_save="${LIBS}"
  1627. LIBS="${LIBS} -lX11"
  1628. have_lib=""
  1629. echo checking for -lX11
  1630. cat > conftest.c <<EOF
  1631.  
  1632. int main() { exit(0); }
  1633. int t() { main(); }
  1634. EOF
  1635. if eval $compile; then
  1636.   have_lib="1"
  1637. fi
  1638. rm -f conftest*
  1639. LIBS="${LIBS_save}"
  1640. if test -n "${have_lib}"; then
  1641.    :; XLIBSW="$XLIBSW -lX11"
  1642. else
  1643.    :; XLIBSW=nope
  1644. fi
  1645.  
  1646. if test "$XLIBSW" = nope; then
  1647.     dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib /usr/X11/lib"
  1648.     for i in $dirs ; do
  1649.         if test -r $i/libX11_s.a; then
  1650.             XLIBSW="-L$i -lX11_s"
  1651.         elif test -r $i/libX11.a; then
  1652.             XLIBSW="-L$i -lX11"
  1653.         fi
  1654.     done
  1655. fi
  1656. if test "$XLIBSW" = nope ; then
  1657.     LIBS_save="${LIBS}"
  1658. LIBS="${LIBS} -lXwindow"
  1659. have_lib=""
  1660. echo checking for -lXwindow
  1661. cat > conftest.c <<EOF
  1662.  
  1663. int main() { exit(0); }
  1664. int t() { main(); }
  1665. EOF
  1666. if eval $compile; then
  1667.   have_lib="1"
  1668. fi
  1669. rm -f conftest*
  1670. LIBS="${LIBS_save}"
  1671. if test -n "${have_lib}"; then
  1672.    :; XLIBSW=-lXwindow
  1673. else
  1674.    :; 
  1675. fi
  1676.  
  1677. fi
  1678. if test "$XLIBSW" = nope ; then
  1679.     echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
  1680.     XLIBSW=-lX11
  1681. fi
  1682.  
  1683.  
  1684. #------------------------------------------------------------------------------
  1685. #       The code below cleans up the DEFS variable to eliminate
  1686. #       duplicate entries.  This makes the eventual make output
  1687. #       look a bit cleaner.
  1688. #------------------------------------------------------------------------------
  1689.  
  1690. newDefs=""
  1691. for i in $DEFS; do
  1692.     if test -z "$newDefs"; then
  1693.         newDefs=$i
  1694.     elif echo $newDefs | fgrep -v -e $i >/dev/null 2>&1; then
  1695.         newDefs="$newDefs $i"
  1696.     fi
  1697. done
  1698. DEFS=$newDefs
  1699.  
  1700. #------------------------------------------------------------------------------
  1701. # Define srcbasedir and bldbasedir as absolute paths.
  1702. #------------------------------------------------------------------------------
  1703.  
  1704. srcbasedir=`cd $srcdir;pwd`
  1705.  
  1706. bldbasedir=`pwd`
  1707.  
  1708.  
  1709. #------------------------------------------------------------------------------
  1710. # Generate the make files.
  1711. #------------------------------------------------------------------------------
  1712.  
  1713. if test -n "$prefix"; then
  1714.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  1715.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  1716. fi
  1717. if test -n "$exec_prefix"; then
  1718.   prsub="$prsub
  1719. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  1720. fi
  1721. cat >conftest.def <<EOF
  1722. $DEFS
  1723. EOF
  1724. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  1725. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  1726. rm -f conftest.def
  1727.  
  1728. trap 'rm -f config.status; exit 1' 1 3 15
  1729. echo creating config.status
  1730. rm -f config.status
  1731. cat > config.status <<EOF
  1732. #!/bin/sh
  1733. # Generated automatically by configure.
  1734. # Run this file to recreate the current configuration.
  1735. # This directory was configured as follows,
  1736. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  1737. #
  1738. # $0 $configure_args
  1739.  
  1740. for arg
  1741. do
  1742.   case "\$arg" in
  1743.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1744.     exec /bin/sh $0 $configure_args ;;
  1745.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  1746.   esac
  1747. done
  1748.  
  1749. trap 'rm -fr Makefile osSupport/Makefile src/Makefile tclsrc/Makefile tksrc/Makefile tktclsrc/Makefile tools/Makefile src/tclXconfig.h conftest*; exit 1' 1 3 15
  1750. YACC='$YACC'
  1751. CC='$CC'
  1752. CPP='$CPP'
  1753. RANLIB='$RANLIB'
  1754. MCS_CMD='$MCS_CMD'
  1755. MAKEINCLUDE='$MAKEINCLUDE'
  1756. MAKEQUOTE='$MAKEQUOTE'
  1757. LIBOBJS='$LIBOBJS'
  1758. MAN_DIR_SEPARATOR='$MAN_DIR_SEPARATOR'
  1759. XINCLUDES='$XINCLUDES'
  1760. XLIBSW='$XLIBSW'
  1761. srcbasedir='$srcbasedir'
  1762. bldbasedir='$bldbasedir'
  1763. LIBS='$LIBS'
  1764. srcdir='$srcdir'
  1765. prefix='$prefix'
  1766. exec_prefix='$exec_prefix'
  1767. prsub='$prsub'
  1768. EOF
  1769. cat >> config.status <<\EOF
  1770.  
  1771. top_srcdir=$srcdir
  1772.  
  1773. # Allow make-time overrides of the generated file list.
  1774. test -n "$gen_files" || gen_files="Makefile osSupport/Makefile src/Makefile tclsrc/Makefile tksrc/Makefile tktclsrc/Makefile tools/Makefile"
  1775.  
  1776. for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
  1777.   srcdir=$top_srcdir
  1778.   # Remove last slash and all that follows it.  Not all systems have dirname.
  1779.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  1780.   if test "$dir" != "$file"; then
  1781.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  1782.     test ! -d $dir && mkdir $dir
  1783.   fi
  1784.   echo creating $file
  1785.   rm -f $file
  1786.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  1787.   sed -e "
  1788. $prsub
  1789. s%@YACC@%$YACC%g
  1790. s%@CC@%$CC%g
  1791. s%@CPP@%$CPP%g
  1792. s%@RANLIB@%$RANLIB%g
  1793. s%@MCS_CMD@%$MCS_CMD%g
  1794. s%@MAKEINCLUDE@%$MAKEINCLUDE%g
  1795. s%@MAKEQUOTE@%$MAKEQUOTE%g
  1796. s%@LIBOBJS@%$LIBOBJS%g
  1797. s%@MAN_DIR_SEPARATOR@%$MAN_DIR_SEPARATOR%g
  1798. s%@XINCLUDES@%$XINCLUDES%g
  1799. s%@XLIBSW@%$XLIBSW%g
  1800. s%@srcbasedir@%$srcbasedir%g
  1801. s%@bldbasedir@%$bldbasedir%g
  1802. s%@LIBS@%$LIBS%g
  1803. s%@srcdir@%$srcdir%g
  1804. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  1805. fi; done
  1806. test -n "$gen_config" || gen_config=src/tclXconfig.h
  1807. echo creating $gen_config
  1808. # These sed commands are put into SEDDEFS when defining a macro.
  1809. # They are broken into pieces to make the sed script easier to manage.
  1810. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  1811. # is the cpp macro being defined and VALUE is the value it is being given.
  1812. # Each defining turns into a single global substitution command.
  1813. #
  1814. # SEDd sets the value in "#define NAME VALUE" lines.
  1815. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  1816. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  1817. SEDdC='\3'
  1818. SEDdD='@g'
  1819. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  1820. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1821. SEDuB='\([     ]\)@\1#\2define\3'
  1822. SEDuC=' '
  1823. SEDuD='\4@g'
  1824. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  1825. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1826. SEDeB='$@\1#\2define\3'
  1827. SEDeC=' '
  1828. SEDeD='@g'
  1829. rm -f conftest.sed
  1830. EOF
  1831. # Turn off quoting long enough to insert the sed commands.
  1832. rm -f conftest.sh
  1833. cat > conftest.sh <<EOF
  1834. $SEDDEFS
  1835. EOF
  1836.  
  1837. # Maximum number of lines to put in a single here document.
  1838. maxshlines=9
  1839.  
  1840. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  1841. # on the size of here documents.
  1842.  
  1843. while :
  1844. do
  1845.   lines=`grep -c . conftest.sh`
  1846.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1847.   rm -f conftest.s1 conftest.s2
  1848.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  1849.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  1850.   # Write a limited-size here document to append to conftest.sed.
  1851.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  1852.   cat conftest.s1 >> config.status
  1853.   echo 'CONFEOF' >> config.status
  1854.   rm -f conftest.s1 conftest.sh
  1855.   mv conftest.s2 conftest.sh
  1856. done
  1857. rm -f conftest.sh
  1858.  
  1859. # Now back to your regularly scheduled config.status.
  1860. cat >> config.status <<\EOF
  1861. # This sed command replaces #undef's with comments.  This is necessary, for
  1862. # example, in the case of _POSIX_SOURCE, which is predefined and required
  1863. # on some systems where configure will not decide to define it in
  1864. # src/tclXconfig.h.
  1865. cat >> conftest.sed <<\CONFEOF
  1866. s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  1867. CONFEOF
  1868. rm -f conftest.h
  1869. # Break up the sed commands because old seds have small limits.
  1870. maxsedlines=20
  1871. cp $top_srcdir/$gen_config.in conftest.h1
  1872. while :
  1873. do
  1874.   lines=`grep -c . conftest.sed`
  1875.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1876.   rm -f conftest.s1 conftest.s2 conftest.h2
  1877.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  1878.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  1879.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  1880.   rm -f conftest.s1 conftest.h1 conftest.sed
  1881.   mv conftest.h2 conftest.h1
  1882.   mv conftest.s2 conftest.sed
  1883. done
  1884. rm -f conftest.sed conftest.h
  1885. echo "/* $gen_config.  Generated automatically by configure.  */" > conftest.h
  1886. cat conftest.h1 >> conftest.h
  1887. rm -f conftest.h1
  1888. if cmp -s $gen_config conftest.h 2>/dev/null; then
  1889.   # The file exists and we would not be changing it.
  1890.   rm -f conftest.h
  1891. else
  1892.   rm -f $gen_config
  1893.   mv conftest.h $gen_config
  1894. fi
  1895.  
  1896.  
  1897. exit 0
  1898. EOF
  1899. chmod +x config.status
  1900. test -n "$no_create" || ./config.status
  1901.  
  1902.